local extension = Package:new("lunar_sp1")
extension.extensionName = "lunar"

extension:loadSkillSkelsByPath("./packages/lunar/pkg/lunar_sp1/skills")

local trans = require("./packages/lunar/pkg/lunar_sp1/trans")

local lvboshe = General:new(extension, "fk__lvboshe", "qun", 4)
lvboshe:addSkills { "fk__kuanyan", "fk__gufu" }

local guoyouzhi = General:new(extension, "fk__guoyouzhi", "shu", 3)
guoyouzhi:addSkills { "fk__zhongyu", "fk__yicha" }

local yingyang = General:new(extension, "fk__yingyang", "wei", 3)
yingyang:addSkills { "fk__guici", "fk__beili" }

local liuyin = General:new(extension, "fk__liuyin", "shu", 4)
liuyin:addSkills { "fk__gushou", "fk__fapi" }

local zhangbu = General:new(extension, "fk__zhangbu", "wu", 3)
zhangbu:addSkills { "fk__guzhu", "fk__zhuanzheng" }

local zhangwei = General:new(extension, "fk__zhangwei", "qun", 4, 4, General.Female)
zhangwei:addSkills { "fk__xiaorong", "fk__yiyong" }

local liyans = General:new(extension, "fk__liyans", "shu", 3)
liyans:addSkills { "fk__duliang", "fulin" }

local fk__zumao = General:new(extension, "fk__zumao", "wu", 4)
fk__zumao:addSkills { "fk__yinbing", "fk__juedi" }

local caohong = General:new(extension, "fk__caohong", "wei", 4)
caohong:addSkills { "fk__yuanhu", "fk__qianlin" }

local fk__simayan = General:new(extension, "fk__simayan", "jin", 4)
fk__simayan:addSkills { "fk__zhice", "fk__taikang", "fk__zongshe" }

local yuanwei = General:new(extension, "fk__yuanwei", "qun", 5)
yuanwei:addSkills { "fk__chongwei", "fk__zuhuo" }

Fk:addPoxiMethod{
    name = "fk__jingzhu",
    card_filter = function(to_select, selected, data)
      if data == nil then return false end
      if #selected == 0 then
        return table.contains(data[1][2], to_select)
      elseif #selected == 1 then
        if not table.contains(data[1][2], selected[1]) then return false end
        local card = Fk:getCardById(to_select)
        local first = Fk:getCardById(selected[1])
        return Self:canUse(card, {bypass_times = true}) and card.trueName ~= first.trueName and card.type == first.type
      end
    end,
    feasible = function(selected, data, extra_data)
      if data == nil or #selected ~= 2 then return false end
      return #table.filter(selected, function (id)
        return table.contains(data[1][2], id)
      end) == 1
    end,
    prompt = "#fk__jingzhu-card",
    default_choice = function ()
      return {}
    end,
  }

local wangsu = General:new(extension, "fk__wangsu", "wei", 3)
wangsu:addSkills { "fk__jingzhu", "fk__yuanxue", "fk__weilun" }
wangsu.subkingdom = "jin"

return extension
